package com.yunli.mall.schema.response;

import com.yunli.mall.enums.SeckillStateEnum;
import com.yunli.mall.schema.entity.PayOrder;

/**
 * 封装秒杀执行后结果
 * Created by liushaoming on 2019-01-14.
 */
public class SeckillExecution {

    private String seckillId;

    //秒杀执行结果状态
    private int state;

    //状态表示
    private String stateInfo;

    //秒杀成功对象
    private PayOrder payOrder;

    @Override
    public String toString() {
        return "SeckillExecution{" +
                "seckillId=" + seckillId +
                ", state=" + state +
                ", stateInfo='" + stateInfo + '\'' +
                ", payOrder=" + payOrder +
                '}';
    }

    public SeckillExecution(String seckillId, SeckillStateEnum stateEnum, PayOrder payOrder) {
        this.seckillId = seckillId;
        this.state = stateEnum.getCode();
        this.stateInfo = stateEnum.getDesc();
        this.payOrder = payOrder;
    }

    public SeckillExecution(String seckillId, SeckillStateEnum statEnum) {
        this.seckillId = seckillId;
        this.state = statEnum.getCode();
        this.stateInfo = statEnum.getDesc();
    }

    public String getSeckillId() {
        return seckillId;
    }

    public void setSeckillId(String seckillId) {
        this.seckillId = seckillId;
    }

    public int getCode() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getDesc() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    public PayOrder getPayOrder() {
        return payOrder;
    }

    public void setPayOrder(PayOrder payOrder) {
        this.payOrder = payOrder;
    }
}
